import request from '@/request/request';
import qs from 'qs';

// 精品推荐数据接口
// export const JingpinAPI = function(){
//   return request.get('/products/recommend');
// }

// 精品推荐数据接口
export const JingpinAPI = () => request.get('/products/recommend');
// 热门兑换
export const ReMenAPI = () => request.get('/products/hot');

//发送验证码接口
export const SendSMSAPI = (params) =>
  request.post('/sendSMS', qs.stringify(params));

//手机验证码登录请求接口
export const PhoneLoginAPI = (params) =>
  request.post('/phoneRegin', qs.stringify(params));

//微信扫码登录请求接口
export const WeixinLoginAPI = (params) =>
  request.post('/wechatUsers/PCLogin', qs.stringify(params));

//手机绑定微信
export const BindPhoneAPI = (params) =>
  request.post('/wechatUsers/binding', qs.stringify(params));

//获取用户信息
export const UserProfilesAPI = () => request.get('/shop/userProfiles');
// console.log('qs1:', qs.stringify({ a: 1, b: 2 }));
// console.log('qs2:', qs.stringify(111));

// 详情页信息
export const GoodDetailsAPI = (id) => request.get(`/products/${id}`);

//加入购物车
export const AddCartAPI = (params) =>
  request.post('/shop/carts/add', qs.stringify(params));

  // 商品搜索
export const GoodsSearchAPI = (params) => request.get('/products',{params});
// 查看购物车
export const CartAPI = () => request.get('/shop/carts');
// 请求删除购物车商品
export const CartDelApi = (params) => request.delete(`/shop/carts?productIds=${params.id}`);